<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/30
 * Time: 10:31
 */

namespace vendor\core;

// 2.4.1 类创建

class person
{
//     2.4.2 类属性和方法，访问控制
    protected $name;
    protected $age;
    protected $gender;

    /**
     * person constructor.
     * @param $name
     * @param $age
     * @param $gender
     */
    public function __construct($name, $age, $gender)
    {
        $this->name = $name;
        $this->age = $age;
        $this->gender = $gender;
        echo "person 对象创建";
        echo "<br>";
    }

    public function eat(){
        echo "eat";
        echo "<br>";
    }

//     2.4.3 构造函数和析构函数

    public function __destruct()
    {
        echo "person 对象清除";
        echo "<br>";
    }

}